
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>员工管理</title>
    <#include "/common/link.ftl">

</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="checking"/>
    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>员工管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <div style="margin: 10px;">
                    <form class="form-inline" id="searchForm" action="/checking/list" method="post">
                        <input type="hidden" name="currentPage" id="currentPage" value="1">
                        <div class="form-group">
                            <label for="keyword"></label>
                            <input type="text" value="${qo.keyword}" class="form-control" name="keyword" placeholder="请输入姓名/邮箱">
                        </div>
                        <button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询</button>
                        <a href="/checking/input" class="btn btn-success btn-input">
                            <span class="glyphicon glyphicon-plus"></span> 添加
                        </a>
                    </form>
                </div>
                <div class="box-body table-responsive ">
                    <form action="/employee/batchdelete" id="batchdeleteForm">
                <table class="table table-hover table-bordered table-striped">
                    <thead>
                    <tr>
                        <th><input type="checkbox" id="allCb"></th>
                        <th>姓名</th>
                        <th>考勤日期</th>
                        <th>记录类型</th>
                        <th>部门</th>
                        <th>删除</th>
                    </tr>
                    </thead>
                    <tbody>
                    <#list result.list as tmp>
                    <tr>
                        <td><input type="checkbox" class="cb" name="ids" value="${tmp.id}"></td>
                        <td>${tmp.name}</td>
                        <script>
                            console.log(${tmp.id})
                        </script>
                        <td>${(tmp.time?string("yyyy-MM-dd HH:mm:ss"))!}</td>
                        <td>${tmp.type.status}</td>
                        <td>${tmp.dept.name}</td>
                        <td>
                            <a href="/checking/input?id=${tmp.id}" class="btn btn-info btn-xs btn_redirect">
                                <span class="glyphicon glyphicon-pencil"></span> 编辑
                            </a>
                            <a deptid="${tmp.id}" href="javascript:void(0);" class="btn btn-danger btn-xs btn-delete btndetele">
                                <span class="glyphicon glyphicon-trash"></span> 删除
                            </a>

                        </td>
                    </tr>
                    </#list>
                    </tbody>
                </table>
                    </form>
                    <!--分页-->
                    <#include "/common/page.ftl">
                </div>

            </div>
        </section>
    </div>
    <#include "/common/footer.ftl">
</div>
<div class="modal fade" id="importModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                            aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="myModalLabel">导入</h4>
            </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary btn-submit" id="uploadSubmit">保存</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
<script>
    $(".btndetele").click(function (){
        var deptid = $(this).attr("deptid");
        console.log(deptid);
        Swal.fire({
            title: '确认删除?',
            text: "删除后无法恢复",
            icon: 'warning',
            showCancelButton: true,
            confirmButtonColor: '#3085d6',
            cancelButtonColor: '#d33',
            confirmButtonText: '确认删除!',
            cancelButtonText: '取消'
        }).then((result) => {
            if (result.value) {
                $.get("/checking/delete",{id:deptid},function (data){
                    Swal.fire({
                        title: '删除成功?',
                        text: "删除后无法恢复",
                        icon: 'success',
                        timer:2000
                    }).then((result) => {
                        window.location.href = "/checking/list";
                        //点击确认按钮后做的事情
                    })
                })
                //点击确认按钮后做的事情

            }
        })
    })
</script>
<script>
    $("#allCb").click(function (){
        $(".cb").prop("checked",$(this).prop("checked"));
    })
    $(".cb").click(function (){
        var all = $(".cb").size();
        var select= $(".cb:checked").size();
        $("#allCb").prop("checked",all==select);
    })

</script>
</html>
